package file.IOS;

import jdk.internal.util.xml.impl.Input;

import java.io.*;

public class Test1 {
//    public static void main(String[] args) throws FileNotFoundException {
//        String path = "./test.txt";
//        try(InputStream inputStream = new FileInputStream(path)) {
//            int read;
//            while (true){
//                read = inputStream.read();
//                if(read == -1){
//                    break;
//                }
//                System.out.printf("0x%x ",read);
//            }
//        } catch (IOException e) {
//            throw new RuntimeException(e);
//        }
//    }
public static void main(String[] args) {
        String path = "./test.txt";
        try(InputStream inputStream = new FileInputStream(path)){
            byte[] data = new byte[1024];
            int n = 0;
            while (true){
                n = inputStream.read(data);
                for (int i = 0; i < n; i++) {
                    System.out.printf("%x ",data[i]);
                }
            }


        } catch (FileNotFoundException e) {

        } catch (IOException e) {
            throw new RuntimeException(e);
        }
}
}
